<template>
  <div style="text-align: center">
    <van-button type="info"  square v-if="$attrs.selectBtn == 0" @click="btnTurn"
      :style="{
        fontSize: $attrs.fontSize,
        color: $attrs.fontColor,
        backgroundColor: $attrs.btnColorCustom,
        border: `none`,
        width: $attrs.width+'px',
        height: $attrs.height+'px',
        fontWeight: $attrs.bold ? 'bold' : 'normal',
        fontStyle: $attrs.italic ? 'italic' : 'normal',
        textDecoration: $attrs.underline ? 'underline' : 'none',
        textAlign: $attrs.textAlign,
      }"
      >
      {{$attrs.moduleName}}
    </van-button>
    <van-button type="info"  plain v-if="$attrs.selectBtn == 1" @click="btnTurn"
    :style="{
      fontSize: $attrs.fontSize,
        color: $attrs.fontColorplan,
        backgroundColor:'white',
        borderStyle:'solid',
        borderWidth:'1px',
        borderColor:$attrs.btnColorplan,
        width: $attrs.width+'px',
        height: $attrs.height+'px',
        fontWeight: $attrs.bold ? 'bold' : 'normal',
        fontStyle: $attrs.italic ? 'italic' : 'normal',
        textDecoration: $attrs.underline ? 'underline' : 'none',
        textAlign: $attrs.textAlign,
    }"
      >
      {{$attrs.moduleName}}
    </van-button>
    <van-button type="info"  round v-if="$attrs.selectBtn == 2" @click="btnTurn"
      :style="{
        fontSize: $attrs.fontSize,
        color: $attrs.fontColor,
        backgroundColor: $attrs.btnColorCustom,
        border: `none`,
        width: $attrs.width+'px',
        height: $attrs.height+'px',
        fontWeight: $attrs.bold ? 'bold' : 'normal',
        fontStyle: $attrs.italic ? 'italic' : 'normal',
        textDecoration: $attrs.underline ? 'underline' : 'none',
        textAlign: $attrs.textAlign,
      }"
      >
      {{$attrs.moduleName}}
    </van-button>
    <van-button type="info"  round plain v-if="$attrs.selectBtn == 3" @click="btnTurn"
      :style="{
        fontSize: $attrs.fontSize,
        color: $attrs.fontColorplan,
        backgroundColor:'white',
        borderStyle:'solid',
        borderWidth:'1px',
        borderColor:$attrs.btnColorplan,
        width: $attrs.width+'px',
        height: $attrs.height+'px',
        fontWeight: $attrs.bold ? 'bold' : 'normal',
        fontStyle: $attrs.italic ? 'italic' : 'normal',
        textDecoration: $attrs.underline ? 'underline' : 'none',
        textAlign: $attrs.textAlign,
      }"
      >
      {{$attrs.moduleName}}
    </van-button>
  </div>
</template>
<script>
import { Dialog } from "vant";
export default {
  name:'vantButton',
  props: {},
  data(){
    return {
      current: 0,
    }
  },
  methods: {
    btnTurn() {
      console.log('kkkk');
      if(this.$attrs.jumpType == 'function'){ //功能
        this.$emit('btnTurn', this.$attrs.functionMenu,'function')
      }else if(this.$attrs.jumpType == 'page'){ //页面
        this.$emit('btnTurn', this.$attrs.jumpPath,'page')
      }else if(this.$attrs.jumpType == 'logout'){ //页面
        if(this.$store.state.mobile.userAgent ==='mobile'){
        this.logout();
      }
      }
      
    },
    async logout() {
      Dialog.confirm({
        message: "确认退出登录?",
      })
        .then(() => {
           this.$store.dispatch('tagsView/delAllViews', [])
        this.$store.dispatch('LogOut').then(() => {
          this.$websocket.close();
          let id = localStorage.getItem('mobileAppid');
          localStorage.clear();
          localStorage.setItem('mobileAppid',id);
          //  location.href = '/login';
           this.$router.replace({ path: '/login' })
        })
        })
        .catch((e) => {
        
        });
      
    }
  },
}
</script>
<style lang="scss" scoped>
  .describe{
    position: absolute;
    color:red;
    bottom: 0;
    font-size: 14px;
  }
  .custom-indicator {
    position: absolute;
    right: 5px;
    bottom: 5px;
    padding: 2px 5px;
    font-size: 12px;
    background: rgba(0, 0, 0, 0.1);
  }
   .publishInfo{
    display:flex;
    flex-wrap: nowrap;
    font-size:14px;
    margin-bottom:10px;
    .leftinfo{
      width:3px;
      background:#409eff;
      flex:none;
    }
    .rightInfo{
      flex:1;
      word-break: break-all;
      font-weight: bold;
      margin-left:6px;
    }
  }
  .my-swipe {
    height: calc(100% - 25px);
  }
  .my-swipe .van-swipe-item {
    width: 100%;
    color: #fff;
    font-size: 20px;
    text-align: center;
  }
  .Mine-categories-swipe{
    padding:10px;
    height: 100%;
    box-sizing: border-box;
  }
  
  .Mine-categories-swipe img{
    display: inline-block;
    width: 100%;
    // height: 100px;
}
</style>

